package com.cinc.ebc.mm.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cinc.ebc.mm.entity.MmMaterialPicking;
import com.cinc.ebc.mm.entity.MmMaterialPickingRet;
import com.cinc.ebc.mm.entity.MmStockInOutDetail;
import com.cinc.ebc.mm.entity.MmStockInOut;
import com.baomidou.mybatisplus.extension.service.IService;
import com.cinc.ebc.mm.model.MmRptStockInOutStatModel;
import com.cinc.ebc.mm.model.MmStockInOutDetailModel;
import com.cinc.ebc.mm.vo.MmRptStockInOutStatPage;
import com.cinc.ebc.mm.vo.MmStockInOutDetailPage;


import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * @Description: 库存单据
 * @Author: jeecg-boot
 * @Date:   2022-04-05
 * @Version: V1.0
 */
public interface IMmStockInOutService extends IService<MmStockInOut> {

	/**
	 * 添加一对多
	 *
	 */
	public void saveMain(MmStockInOut mmStockInOut,List<MmStockInOutDetail> mmStockInOutDetailList) throws Exception;

	public void saveMain(MmStockInOut mmStockInOut,List<MmStockInOutDetail> mmStockInOutDetailList, boolean isAllocate) throws Exception;

	/**
	 * 修改一对多
	 *
	 */
	public void updateMain(MmStockInOut mmStockInOut,List<MmStockInOutDetail> mmStockInOutDetailList);

	/**
	 * 删除一对多
	 */
	public void delMain (String id);

	/**
	 * 批量删除一对多
	 */
	public void delBatchMain (Collection<? extends Serializable> idList);

    Page<MmStockInOutDetailModel> purchaseInPage(Page<MmStockInOutDetailModel> page, MmStockInOutDetailPage mmStockInOutDetailPage);

    Page<MmStockInOutDetailModel> purchaseBackPage(Page<MmStockInOutDetailModel> page, MmStockInOutDetailPage mmStockInOutDetailPage);

	void saveMainPurchaseIn(MmStockInOut mmStockInOut, List<MmStockInOutDetail> mmStockInOutDetailList) throws Exception;

	void saveMainPurchaseBack(MmStockInOut mmStockInOut, List<MmStockInOutDetail> mmStockInOutDetailList) throws Exception;

	Page<MmStockInOutDetailModel> otherInPage(Page<MmStockInOutDetailModel> page, MmStockInOutDetailPage mmStockInOutDetailPage);

	Page<MmStockInOutDetailModel> otherOutPage(Page<MmStockInOutDetailModel> page, MmStockInOutDetailPage mmStockInOutDetailPage);
	Page<MmStockInOutDetailModel> inventoryProfitPage(Page<MmStockInOutDetailModel> page, MmStockInOutDetailPage mmStockInOutDetailPage);
	Page<MmStockInOutDetailModel> inventoryLossPage(Page<MmStockInOutDetailModel> page, MmStockInOutDetailPage mmStockInOutDetailPage);

	void detaiPage(Page<MmStockInOutDetailModel> page, MmStockInOutDetailPage detailPage);

    List<MmStockInOutDetailModel> detailList(MmStockInOutDetailPage detailPage);

    /**
     * 单据冲销
     *
     * @param detailPageList
     * @return void
     * @throws
     */
	void writeOff(List<MmStockInOutDetailPage> detailPageList) throws Exception;

    void saveMainInventoryProfit(MmStockInOut mmStockInOut, List<MmStockInOutDetail> mmStockInOutDetailList) throws Exception;

	void saveMainInventoryLoss(MmStockInOut mmStockInOut, List<MmStockInOutDetail> mmStockInOutDetailList) throws Exception;

	void saveMainSalesOut(MmStockInOut mmStockInOut, List<MmStockInOutDetail> mmStockInOutDetailList, boolean isAllocate) throws Exception;

	void saveMainSalesReturn(MmStockInOut mmStockInOut, List<MmStockInOutDetail> mmStockInOutDetailList) throws Exception;

	void saveMainMaterialPicking(MmStockInOut mmStockInOut, List<MmStockInOutDetail> mmStockInOutDetailList, MmMaterialPicking materialPicking) throws Exception;

    IPage<MmRptStockInOutStatModel> queryRptStockInOutStatList(Page<MmRptStockInOutStatModel> page, MmRptStockInOutStatPage mmRptStockInOutStatPage);

	Page<MmStockInOutDetailModel> rptPage(Page<MmStockInOutDetailModel> page, MmStockInOutDetailPage mmStockInOutDetailPage);

    void saveMainMaterialPickingRet(MmStockInOut stockInOut, List<MmStockInOutDetail> stockInOutDetailList, MmMaterialPickingRet materialPickingRet) throws Exception;
}
